Optimize solari initial and temporal DI#20156
Merged
alice-i-cecile merged 15 commits intobevyengine:mainfrom Aug 10, 2025
Merged
Optimize solari initial and temporal DI#20156alice-i-cecile merged 15 commits intobevyengine:mainfrom
alice-i-cecile merged 15 commits intobevyengine:mainfrom
Conversation
Member
|
Please add this PR (and yourself!) to the draft release notes :) |
Contributor
|
Lets hold off on this until #20213 is merged. |
Member
|
@SparkyPotato the linked PR is merged; could you resolve conflicts and merge main in please? |
Contributor
|
I'm getting instant NaNs with this PR :( |
JMS55
reviewed
Aug 2, 2025
| if reservoir_valid(reservoir) { | ||
| let inverse_target_function = select(0.0, 1.0 / reservoir_target_function, reservoir_target_function > 0.0); | ||
| reservoir.unbiased_contribution_weight = weight_sum * inverse_target_function; | ||
|
|
JMS55
reviewed
Aug 2, 2025
| return empty_reservoir(); | ||
| } | ||
| temporal_reservoir.sample.light_id = (light_id << 16u) | triangle_id; | ||
|
|
Contributor
|
JMS55
approved these changes
Aug 4, 2025
tychedelia
approved these changes
Aug 6, 2025
Member
tychedelia
left a comment
There was a problem hiding this comment.
Very cool. Surprised how big a win this is.
IceSentry
approved these changes
Aug 7, 2025
Member
|
@SparkyPotato ready to merge once conflicts are resolved :) |
gwafotapa
pushed a commit
to gwafotapa/bevy
that referenced
this pull request
Aug 12, 2025
# Objective Optimizes the initial + temporal ReSTIR DI pass. In the example cornell box scene, it goes from 2.37 ms to 1.97 ms. On a more complex scene, the Lumberyard bistro, with many emissive lights, it goes from 130+ ms to about 80.8 ms at 1440p on a 4070. I also noticed that triangle area calculation didn't take object scale into account and fixed that. ## Solution - Switch to textures instead of buffers for reservoir storage. - There's also a bunch of other micro-optimizations to increase SM occupancy and reduce memory pressure. ## Testing - This was tested on the cornell box example scene and bistro. - Everything was tested on Windows 11 with a 4070 running at 1440p. Testing on other platforms and GPUs by running the example. --- ## Showcase <img width="2560" height="1392" alt="image" src="https://github.com/user-attachments/assets/b53f66e8-c97d-4f94-b30f-bbe6ade1a507" />
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Optimizes the initial + temporal ReSTIR DI pass. In the example cornell box scene, it goes from 2.37 ms to 1.97 ms. On a more complex scene, the Lumberyard bistro, with many emissive lights, it goes from 130+ ms to about 80.8 ms at 1440p on a 4070.
I also noticed that triangle area calculation didn't take object scale into account and fixed that.
Solution
Testing
Showcase